package lanqiao_14;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main {
    public static void main(String[] args) {
        // 二分 + 排序 + 贪心
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long[] nums = new long[n];
        for(int i =0; i < n; i++) {
            nums[i] = in.nextLong();
        }

        long sum = 0L;
    

          // 排序
          Arrays.sort(nums);

          Queue<Long> queue = new LinkedList<>();
          int count = 0;

          for(int i = n - 1; i >= 0 ; i--) {
                if(nums[i] <= queue.peek()) {
                  // 略过这一步
                  // 并且把需要查找的目标清除
                  // 寻找下一个
                  queue.poll();
                } else {
                    count++;
                    sum += nums[i];
                    if(count % 2 == 0) {
                        // 代表第二个
                        // 如果是第二件
                        // 就需要不断寻找从大到小目标值
                        queue.add(nums[i] / 2);
                    } 
                }
          }

          // System.out.println("当前下标为： " +  right + " 数字为： " + list.get(right));
          

          
          System.out.println(sum);
          in.close();
    }
            
}

/**
 * 数学+ 区间：矩形总面积
 */

class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long x1 = in.nextLong(), y1 = in.nextLong(),
                x2 = in.nextLong() , y2 = in.nextLong();
        long x3 = in.nextLong(), y3 = in.nextLong(),
                x4 = in.nextLong(), y4 = in.nextLong();
        // 如果不抢转自身就是int 运算， 就一定会
        long a = (y2 - y1) * (x2 - x1);
        long b = (y4 - y3) * (x4 - x3);
        long tar1 = Math.min(x2,x4) - Math.max(x1 , x3);
        long tar2 = Math.min(y2,y4) - Math.max(y1,y3);

        if(tar1 > 0 && tar2 > 0) {
            System.out.println((a + b) - (tar1 * tar2));
        } else {
            System.out.println(a + b );
        }
        in.close();
    }
}
